﻿using System;
using ECommerce.Web.NHibernate.Sessions;
using ECommerce.Web.NHibernate.Sessions.Storage;

namespace ECommerce.Web
{
    public class MvcApplication : System.Web.HttpApplication
    {        
        protected void Application_Start()
        {
            Bootstrapper.Configure();
        }

        protected void Application_BeginRequest(object sender, EventArgs e)
        {
            SessionSource.Current.SetSessionStorage(new ContextItemSessionStorage());
        }

        protected void Application_EndRequest(object sender, EventArgs e)
        {
            SessionSource.Current.CloseSession();
        }
    }
}